package com.administrator.customviewtest.view.scrollview;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.TextView;

import com.administrator.customviewtest.R;
import com.administrator.customviewtest.TestAct;
import com.administrator.customviewtest.kotlin.KotlinTestKt;
import com.administrator.customviewtest.successview.ProgressView;

/**
 * Created by Administrator on 2017/6/5.
 */

public class ScrollTestAct extends Activity {
    private RecyclerView recyclerView;
    private String[] arrays = new String[]{"1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"};
    private RecyclerView.Adapter adapter;
   private int a =  KotlinTestKt.getA();
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        startActivity(new Intent(this, TestAct.class));

        ((ProgressView) findViewById(R.id.voice)).setVoiceUpdateLinstener(new ProgressView.OnVoiceUpdateLinstener() {
            @Override
            public void onVoiceChanged(int voice) {
                ((TextView) findViewById(R.id.tv)).setText("音量:"+voice);
            }
        });
//        recyclerView = (RecyclerView) findViewById(R.id.rv);
//
//        recyclerView.setLayoutManager(new LinearLayoutManager(this));
//
//        adapter = new RecyclerView.Adapter() {
//            @Override
//            public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
//                return new Viewholder(View.inflate(ScrollTestAct.this, android.R.layout.simple_list_item_1, null));
//            }
//
//            @Override
//            public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
//                ((Viewholder) holder).textView.setText(arrays[position]);
//            }
//
//            @Override
//            public int getItemCount() {
//                return arrays.length;
//            }
//        };
//
//        recyclerView.setAdapter(adapter);


    }

    public class Viewholder extends RecyclerView.ViewHolder {
        private TextView textView;

        public Viewholder(View itemView) {
            super(itemView);
            textView = (TextView) itemView.findViewById(android.R.id.text1);
        }
    }

    public void button1(View view) {
        ((RefreshLayout) findViewById(R.id.rf)).endRefresh();
    }
    public void button2(View view) {
        arrays = new String[]{"1", "2", "3", "4", "5", "6", "7", "8"};
        adapter.notifyDataSetChanged();
    }
}
